package net.hctek.identity.util.file;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

import net.hctek.identity.bean.User;
import net.hctek.identity.util.Contant;

public class UserloginInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = 1L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		ServletActionContext.getRequest().setCharacterEncoding("utf-8");
		ServletActionContext.getResponse().setCharacterEncoding("utf-8");
		User user = (User)ServletActionContext.getRequest().getSession().getAttribute(Contant.SESSION_USER);
		if(user==null){
			return "input";
		}
		return invocation.invoke();
	}

}
